<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	template="../Template/Template.xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:fmt="http://java.sun.com/jsp/jstl/fmt">

	<ui:define name="title">
    Trang kết quả tìm kiếm
  	</ui:define>

	<ui:define name="content">
		<div id="MainPanel" align="left">
			<div class="ContentPart">
				<h1 class="ContentPartTitle" align="center">TRANG KẾT QUẢ TÌM
					KIẾM</h1>
			</div>
			<div class="ContentPart">
				<div class="ContentPartContent">
					<p class="bold mediumSize">
						<c:if test="#{trangKetQuaTimKiemCBBean.lstSanPham.size() == 0}">
							<h:outputText value="Không có kết quả phù hợp cho từ khóa " />
							<span class="mediumSize bold red italic">
								"#{trangKetQuaTimKiemCBBean.chuoitimkiem}"</span>
						</c:if>

						<c:if test="#{trangKetQuaTimKiemCBBean.lstSanPham.size() > 0}">
								Đã tìm thấy kết quả cho từ khóa <span
								class="mediumSize bold red italic">
								"#{trangKetQuaTimKiemCBBean.chuoitimkiem}"</span>
						</c:if>
					</p>
				</div>
			</div>
			<c:if test="#{trangKetQuaTimKiemCBBean.lstSanPham.size() > 0}">
				<div id="PhanTrang">
					Trang
					<c:forEach var="i" begin="0"
						end="#{trangKetQuaTimKiemCBBean.XacDinhSoTrang() - 1}">				
	        &#160; &#160; &#160; &#160;   
	        
	        <h:link value="#{i + 1}"
							outcome="TrangKetQuaTimKiemCB?faces-redirect=true">
							<f:param name="thututrang" value="${i + 1}"
								action="#{trangKetQuaTimKiemCBBean.LaySanPhamTheoNhom(i)}" />
						</h:link>


					</c:forEach>
				</div>

				<div class="boxContainer" align="center">

					<ui:repeat value="#{trangKetQuaTimKiemCBBean.lstSanPham}"
						var="sanpham">

						<!-- <section> -->
						<div class="productBox">
							<div class="productName">
								<h2 align="center">
									<a href="#"> #{sanpham.tensanpham}</a>
								</h2>
							</div>

							<h:link outcome="TrangChiTietSanPham?faces-redirect=true">
								<f:param name="masanpham" value="#{sanpham.masanpham}"
									action="#{trangChiTietSanPhamBean.LaySanPhamTheoMaSP()}" />
								<img class="productImage imgNoBackgroundBorder" align="middle"
									src="../Images/Products/#{sanpham.hinhanh}" />
							</h:link>


							<p class="productIntro">#{sanpham.mota}</p>
							<div>
								<h:commandButton class="buttonLink button viewDetailButton"
									action="#{trangChiTietSanPhamBean.ShowSanPham(sanpham)}"
									value="Xem" />

								<!-- <p class="productPrice">
									<h:outputText value="#{sanpham.giaban}">
										<f:convertNumber groupingUsed="true" pattern="#0,000" />
									</h:outputText>
									VNÄ�
								</p> -->
								<h:outputText class="productPrice" value="#{sanpham.giaban}">
									<f:convertNumber groupingUsed="true" pattern="#0,000" />
								</h:outputText>
								VNĐ


								<h:commandLink process="@this" immediate="true"
									class="smallCartIcon"
									action="#{gioHangBean.ThemSanPham(sanpham.masanpham)}">
									<img class="smallCartIcon imgNoBackgroundBorder"
										src="../Images/green_cart.png" align="right" />
								</h:commandLink>

							</div>
						</div>
						<!-- </section> -->

					</ui:repeat>

				</div>
			</c:if>
		</div>
	</ui:define>
</ui:composition>

